package entity

import (
	"server/world/scene"
)

type MessageType int32

const (
	MessageTypeNone   MessageType = 0
	MessageTypeStatus MessageType = 1
	MessageTypeMove   MessageType = 2 //移动到位置
	MessageTypeEntry  MessageType = 3 //进入场景
	MessageTypeLeave  MessageType = 4 //离开场景
)

type Message struct {
	T MessageType `json:"t"`
	K int64       `json:"k"`
}

type Movement struct {
	Message
	Pos *scene.Position `json:"pos,omitempty"`
}

type SceneJoin struct {
	Message
}
type SceneLevel struct {
	Message
}

type PlayerStatus struct {
	Message
	Status scene.EntityStatus `json:"status"`
}

func NewPlayerStatus(p int64, s scene.EntityStatus) *PlayerStatus {
	return &PlayerStatus{
		Message: Message{
			T: MessageTypeStatus,
			K: p,
		},
		Status: s,
	}
}
